package com.springStudy.mvc.firstDemo;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FirstDemoController {
    @GetMapping("/greeting")
    public JSONObject greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
        JSONObject s = new JSONObject();
        s.put("name", String.format("Hello, %s!", name));
        return s;
    }
}
